const antfu = require('@antfu/eslint-config').default
const unocss = require('@unocss/eslint-plugin')

const isProduct = require('node:process').env.NODE_ENV === 'production'

module.exports = antfu({
  stylistic: true,
  vue: true,
  // off or 0 - 关闭(禁用)规则
  // warn or 1 - 将规则视为一个警告（并不会导致检查不通过）
  // error or 2 - 将规则视为一个错误 (退出码为1，检查不通过)
  rules: {
    'arrow-parens': 0,
    'curly': 0,
    'prefer-promise-reject-errors': 0,
    'style/array-bracket-spacing': 0,

    // allow debugger during development only
    'no-debugger': isProduct ? 2 : 0,
    'no-console': isProduct ? 1 : 0,
    'no-unused-vars': 1,
    '@typescript-eslint/no-unused-vars': isProduct ? 1 : 0,
    '@typescript-eslint/brace-style': 0,
    'vue/first-attribute-linebreak': 0,
    'vue/multi-word-component-names': 0,
    'vue/singleline-html-element-content-newline': 0,
    'vue/component-tags-order': [ 'error', {
      order: [ [ 'template', 'script' ], 'style' ],
    } ],
    'array-bracket-newline': [
      'off',
      { multiline: true, minItems: 3 },
    ],
    'array-bracket-spacing': [
      'warn',
      'always',
    ],
  },
  ignores: [
    '/dist',
    '/src-capacitor',
    '/src-cordova',
    '/.quasar',
    '/.idea',
    '/node_modules',
    'postcss.config.js',
    'index.html',
    './README.md',
  ],
}, unocss.configs.flat)
